﻿@model IEnumerable<HanGu.Entity.MemberChildren>
@{
    Layout = null;
    int i = 1;
    ViewBag.ViewTitle = "客户子女信息";
    var SexList = ViewData["SexList"] as SelectList;
    var action=Request["action"];
    var read = action != null && action == "read";
}
<div class="pageContent">
    <script>
        function mydialogAjaxDone(json) {
            DWZ.ajaxDone(json);
            if (json.statusCode == DWZ.statusCode.ok) {
                if (json.navTabId) {
                    var $this = $("#" + json.navTabId);
                    $this.loadUrl($this.attr("ref"));
                } else if (json.rel) {
                    navTabPageBreak({}, json.rel);
                }
                if ("closeCurrent" == json.callbackType) {
                    $.pdialog.closeCurrent();
                }
            }
        }
       
        			
    </script>
    @if (!read)
    {
    <div class="panelBar">
        <ul class="toolBar">
            <li><a class="add" href='CustomerInfo/MemberChildren/create/0/@ViewData["ParentID"]' width="800" height="500" target="dialog" title="添加-@ViewBag.ViewTitle">
                <span>添加</span></a></li>
        </ul>
    </div>
    }
    <table class="table" width="100%">
        <thead>
            <tr class="header">
                <th>
                    序号
                </th>
                <th>
                    姓名
                </th>
                <th>
                    性别
                </th>
                <th>
                    生日
                </th>
                <th>
                </th>
            </tr>
        </thead>
        @foreach (var item in Model)
        {            
            <tr target="CustomerGroup_id" rel="@item.ID" >
                <td>
                    @i
                </td>
                <td>
                    @item.RealName
                </td>
                <td>
                    @{
            var tmpmodel = SexList.Where(c => c.Value == item.Sex).FirstOrDefault();
            if (tmpmodel != null)
            { 
                        @tmpmodel.Text
            }
                    }
                </td>
                <td>
                    <span formatdate="yyyy-MM-dd">
                        @item.Birthday
                    </span>
                </td>
                <td>
                    @if (!read)
                    {
                    <a class="" href="CustomerInfo/MemberChildren/create/@item.ID/@ViewData["ParentID"]?action=edit"  width="800" height="500" target="dialog" title="修改-@ViewBag.ViewTitle">
                        <span>修改</span></a> <span>&nbsp;</span> <a class="" href="CustomerInfo/MemberChildren/Delete/@item.ID/@item.ParentID" callback="mydialogAjaxDone" target="ajaxTodo" title="确定要删除吗？">
                            <span>删除</span></a>
                    }
                </td>
            </tr>
            i += 1;
        }
    </table>
</div>
